<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		body{
			background-color: #DDD
		}
		#Box{
			width: 500px;
			height: 30px;
			margin: 50px auto;
			color: #000;
			font-size: 36px;
		}
        #Box span{
        	font-family:"微软雅黑";
        }

	</style>
	<script type="text/javascript">
         //数字补0
         function toDou(n){
            if (n<10) {
            	return '0'+n;
            }else{
            	return ''+n;
            }
         } 


        window.onload=function(){
            var oBox=document.getElementById('Box');
            var aSpan=document.getElementsByTagName('span');
	        

            function tickText(){
	            //创建一个时间对像
				var oDate = new Date();
		        //获取时分秒;  
	            //var strDateTime='<span>'+toDou(oDate.getHours())+"</span><b>:</b>"+'<span>'+toDou(oDate.getMinutes())+"</span><b>:</b>"+'<span>'+toDou(oDate.getSeconds()+"</span>");
               
                var strGetFullYear=oDate.getFullYear(); //年
                var strGetMonth=toDou(oDate.getMonth()+1); //月
                var strGetDate=toDou(oDate.getDate()); //月
                var strGetHours=toDou(oDate.getHours());
				var strGetMinutes=toDou(oDate.getMinutes());
				var strGetSeconds=toDou(oDate.getSeconds());
				var strGetDay=oDate.getDay();//周
				//var strGetTime=toDou(oDate.getTime());
                var strDateTime = strGetHours+strGetMinutes+strGetSeconds;

	            oBox.innerHTML='<p><span>'+strGetFullYear+'-</span><span>'+strGetMonth+'-</span><span>'+strGetDate+'</span><b>   </b><span>'+strGetHours+':</span><span>'+strGetMinutes+':</span><span>'+strGetSeconds+'</span><span> 星期 '+strGetDay+'</span></p>';
                //console.log(strDateTime);
            }


            setInterval(tickText,1000);
            tickText(); // 立即执行，去除默认的000000



        }
	</script>
</head>
<body>
	<div id="Box">
        <span>0</span>
        <span>0</span>
        <b>:</b>
        <span>0</span>
        <span>0</span>
        <b>:</b>
        <span>0</span>
        <span>0</span>
	</div>
</body>
</html>